Many modern software applications display three-dimensional representations of objects and scenes as part of a user interface. Three-dimensional (3D) graphics are used in a wide range of applications including games, simulations, virtual reality applications, geospatial information applications, and applications for mapping and navigation. In many applications, 3D graphics are more useful than two-dimensional (2D) graphics at depicting real-world environments and locations because the normal interaction between humans and the real-world occurs in three dimensions.
In one form of 3D graphics, different objects in a scene are formed from a large number of polygons. The polygons form shapes and structures in a 3D scene. Since most computing devices only display graphics with a two-dimensional display, the 3D graphics are converted into a rasterized array of two-dimensional pixels for display. The 2D display depicts portions of the three-dimensional scene in a similar manner to how a camera takes a two-dimensional photograph of 3D scenes in the real world. The portal through which the 2D display depicts a 3D virtual environment is referred to as a “view frustum”, and objects in the virtual environment appear to be at different distances from the view frustum. Many 3D graphics systems and application programming interfaces (APIs) including the Open Graphics Library (OpenGL) and the Direct 3D APIs provide common structures and interfaces to specialized graphics hardware for generation of 3D images in an efficient manner. The 3D software interacts with general purpose and specialized digital computing hardware that generates the 3D graphics in an efficient manner. In particular, graphical processing units (GPUs) are hardware components that are configured to generate polygons and other graphical effects that form a 3D scene. Modern computing devices typically execute software with a combination of instructions for a central processing unit (CPU) and the GPU to generate the 3D scene and enable interaction with the 3D scene in some software applications. In some hardware embodiments, the functionality of the CPU and GPU are merged together, physically and optionally logically, into a single a system on a chip (SoC) device.
In modern 3D graphics, the final display includes additional graphical details that go beyond a simple rendering of polygons to provide additional detail and realism. For example, rendered polygons typically receive one or more textures that simulate the appearance of materials in the real world such as wood, stone, metal, cloth, and many other materials. In many embodiments, a texture is a two-dimensional drawing or photograph of a material that is applied to surfaces of 3D objects to give the three-dimensional objects a more realistic appearance. In some instances, a texture is applied to the surfaces of a 3D object in a repeated pattern. For example, a brick texture is repeated multiple times across a surface of a polygon to give the appearance of a brick wall with a repeated pattern of bricks.
Many software applications that model 3D objects us a large number of textures. Due to memory access patterns that are commonly used with 3D APIs such as OpenGL, many 3D applications store multiple textures in one or more texture atlases. Each texture atlas is a larger 2D image that includes multiple individual textures arranged within the larger 2D image. The 3D software application stores coordinates for the individual textures within the texture atlas and can retrieve only selected portions of the texture from the texture atlas for mapping to 3D objects. The texture atlas provides a performance benefit because the atlas stores multiple textures in a single contiguous block of memory. Loading a single texture atlas into memory and applying textures from the atlas to one or more 3D objects is more efficient than loading individual textures into separate memory addresses for each of the objects.
As describe above, existing 3D software and hardware enables repetition of a texture across the surfaces of a 3D object and enables the use of texture atlases for efficient access to multiple textures. Existing 3D systems, however, do not provide efficient mechanisms to enable repeated textures to be formed across objects when the textures are stored in a larger texture atlas. For example, the OpenGL API provides texture wrapping functionality with a parameter (GL_REPEAT) that specifies repetition of a texture over the surface of a 3D object. The OpenGL texture wrapping functionality is not compatible with texture atlases, however, because the texture wrapping functionality wraps the entire texture atlas over the surface of the 3D object instead of merely wrapping a selected texture from the texture atlas. More complex methods for extracting textures from a texture atlas using programmable shaders exist, but the existing solutions suffer from artifacts when a mip-map process is used to render textures over a range of sizes and distances from the foreground of a 3D scene. Mip-mapping is a commonly used process in 3D graphics, and the existing methods for rendering repeated textures that are retrieved from texture atlases produce visible artifacts that appear as seams between copies of the repeated texture graphics. Consequently, improved methods of mapping repeated textures to 3D objects that enable use of texture atlases with mip-mapped textures would be beneficial.